package jsu.hx.lost.Config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 统一映射所有上传目录到根路径`/uploads/**`
        registry.addResourceHandler("/uploads/**")
                .addResourceLocations("file:./uploads/") // 所有上传文件存放在项目根目录的`uploads`文件夹下
                .setCachePeriod(3600);
    }
}